package org.adorsys.aderp.jpa.impl;

import java.io.Serializable;

import javax.persistence.EntityManager;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;

public class AderpRepositoryFactoryBean<T extends JpaRepository<S, ID>, S, ID extends Serializable> extends 
		JpaRepositoryFactoryBean<T, S, ID> implements BeanFactoryAware
{
	private BeanFactory beanFactory;
	
	@Override
	protected RepositoryFactorySupport createRepositoryFactory(
			EntityManager entityManager) {
		return new AderpRepositoryFactory(entityManager, beanFactory);
	}
	
	
	public void setBeanFactory(BeanFactory beanFactory) {
		this.beanFactory = beanFactory;
		super.setBeanFactory(beanFactory);
	}
	
	
}
